package jddk;

import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.stream.Collectors;

import org.springframework.data.util.Streamable;
import org.springframework.util.CollectionUtils;

import cn.hutool.core.util.IdUtil;

public class StreamTest {

	public static void main(String[] args) {

		//KeyUtil.generateKey("AES");
		//AES aes = SecureUtil.aes("12121212121212121212121212".getBytes());
		//System.out.println(aes.encryptBase64("guojian"));//amr/WrchTwpVZfYoffMM+g==
		//	System.out.println(SecureUtil.aes().decryptStr("amr/WrchTwpVZfYoffMM+g=="));
		
	}

	private static void idutils() {
		System.out.println(IdUtil.fastSimpleUUID());

		System.out.println(IdUtil.simpleUUID());

		System.out.println(IdUtil.fastUUID());

		System.out.println(IdUtil.objectId());//6063df7ee0117f2c403897ce//6063df86e011d31b28a566fc
	}

	public static void test1111() {
		int aaa = '男';

		System.out.println((int) 'a');//a对应的byte
		System.out.println((int) '国');
		System.out.println((char) 97);//byte转成字符

		System.out.println((int) '中' + "=====中");

		byte[] byte1 = "中国".getBytes();

		for (byte b : byte1) {
			System.out.print(b);
		}

		System.out.println();
	}

	public void testM() {
		Iterable<String> it = Arrays.asList("a", "b", "v");
		//System.out.println(org.springframework.util.CollectionUtils.arrayToList(it));
		
		//CollectionUtils.arrayToList(source)
		
		
		System.out.println(Array.get(it, 0));
		
		Streamable.of(it).stream().map(this::save).collect(Collectors.toList());
	}

	public String save(String t) {
		System.out.println("save: " + t);
		return t;
	}
}
